/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package diepafi;

import javax.persistence.EntityManager;
import programm.DBmanager;


/**
 *
 * @author Παναγιώτης
 */
public class MainMenuGUI extends javax.swing.JFrame {
    
    private static EntityManager em;    //o entity manager


    /**
     * Creates new form MainMenuGUI
     */
    public MainMenuGUI() {
        DBmanager dbm = new DBmanager(); 
        MainMenuGUI.em=dbm.getEm();
        dbm.dbmanager();
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTextField1 = new javax.swing.JTextField();
        jFrame1 = new javax.swing.JFrame();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jButtonAbout = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuArtist = new javax.swing.JMenuItem();
        jMenuItemGroup = new javax.swing.JMenuItem();
        jMenuItemGroupAlbum = new javax.swing.JMenuItem();
        jMenuItemArtistAlbum = new javax.swing.JMenuItem();
        jMenuPlaylist = new javax.swing.JMenu();
        jMenuExit = new javax.swing.JMenu();

        jTextField1.setText("jTextField1");

        javax.swing.GroupLayout jFrame1Layout = new javax.swing.GroupLayout(jFrame1.getContentPane());
        jFrame1.getContentPane().setLayout(jFrame1Layout);
        jFrame1Layout.setHorizontalGroup(
            jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        jFrame1Layout.setVerticalGroup(
            jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Διαχείριση Μουσικής Ραδιοφωνικού Σταθμού");
        setResizable(false);

        jPanel1.setBackground(new java.awt.Color(0, 0, 0));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/onair1.gif"))); // NOI18N

        jButtonAbout.setBackground(new java.awt.Color(51, 51, 51));
        jButtonAbout.setForeground(new java.awt.Color(255, 255, 255));
        jButtonAbout.setText("Σχετικά");
        jButtonAbout.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jButtonAbout.setFocusPainted(false);
        jButtonAbout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAboutActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jButtonAbout)
                .addContainerGap())
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(jLabel1)
                .addContainerGap(30, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap(20, Short.MAX_VALUE)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonAbout)
                .addContainerGap())
        );

        jMenuBar1.setBorder(null);
        jMenuBar1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jMenuBar1.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        jMenuBar1.setPreferredSize(new java.awt.Dimension(374, 30));

        jMenu1.setBorder(null);
        jMenu1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/acoustic4.png"))); // NOI18N
        jMenu1.setText("Διαχείριση Αρχείων");
        jMenu1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jMenu1.setFocusCycleRoot(true);
        jMenu1.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
        jMenu1.setNextFocusableComponent(jMenuPlaylist);

        jMenuArtist.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        jMenuArtist.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/kallitexnis.png"))); // NOI18N
        jMenuArtist.setText("Καλλιτέχνες");
        jMenuArtist.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jMenuArtist.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuArtistActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuArtist);

        jMenuItemGroup.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemGroup.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/sigrotimata.png"))); // NOI18N
        jMenuItemGroup.setText("Συγκροτήματα");
        jMenuItemGroup.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jMenuItemGroup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemGroupActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItemGroup);

        jMenuItemGroupAlbum.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItemGroupAlbum.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/music200.png"))); // NOI18N
        jMenuItemGroupAlbum.setText("Άλμπουμ Συγκροτημάτων");
        jMenuItemGroupAlbum.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jMenuItemGroupAlbum.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemGroupAlbumActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItemGroupAlbum);

        jMenuItemArtistAlbum.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItemArtistAlbum.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/music200.png"))); // NOI18N
        jMenuItemArtistAlbum.setText("Άλμπουμ Καλλιτεχνών");
        jMenuItemArtistAlbum.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jMenuItemArtistAlbum.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemArtistAlbumActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItemArtistAlbum);

        jMenuBar1.add(jMenu1);

        jMenuPlaylist.setBorder(null);
        jMenuPlaylist.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/treble4.png"))); // NOI18N
        jMenuPlaylist.setText("Λίστες Τραγουδιών");
        jMenuPlaylist.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jMenuPlaylist.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
        jMenuPlaylist.setNextFocusableComponent(jMenuExit);
        jMenuPlaylist.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenuPlaylistMouseClicked(evt);
            }
        });
        jMenuBar1.add(jMenuPlaylist);

        jMenuExit.setBackground(new java.awt.Color(255, 255, 255));
        jMenuExit.setBorder(null);
        jMenuExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/power17.png"))); // NOI18N
        jMenuExit.setText("Έξοδος");
        jMenuExit.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jMenuExit.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
        jMenuExit.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jMenuExit.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
        jMenuExit.setIconTextGap(10);
        jMenuExit.setMargin(new java.awt.Insets(0, 30, 0, 30));
        jMenuExit.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenuExitMouseClicked(evt);
            }
        });
        jMenuBar1.add(jMenuExit);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuArtistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuArtistActionPerformed
        //ανοίγει την φόρμα διαχείρισης καλλιτεχνών
        KallitexnesGUI frame= new KallitexnesGUI(this);
        frame.setLocation((int) this.getLocation().getX(),(int) this.getLocation().getY());
        frame.setVisible(true);
        this.setEnabled(false); //απενεργοποιεί το παρόν μέχει να κλείσει το frame
    }//GEN-LAST:event_jMenuArtistActionPerformed

    private void jMenuItemGroupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemGroupActionPerformed
        //ανοίγει την φόρμα διαχείρισης συγκροτημάτων
        GroupGUI frame= new GroupGUI(this);
        frame.setLocation((int) this.getLocation().getX(),(int) this.getLocation().getY());
        frame.setVisible(true);
        this.setEnabled(false); //απενεργοποιεί το παρόν μέχει να κλείσει το frame
    }//GEN-LAST:event_jMenuItemGroupActionPerformed

    private void jMenuItemGroupAlbumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemGroupAlbumActionPerformed
        //ανοίγει την φόρμα άλμπουμ συγκροτημάτων
        MusicGroupAlbumGUI frame= new MusicGroupAlbumGUI(this);
        frame.setLocation((int) this.getLocation().getX(),(int) this.getLocation().getY());
        frame.setVisible(true);
        this.setEnabled(false); //απενεργοποιεί το παρόν μέχει να κλείσει το frame
    }//GEN-LAST:event_jMenuItemGroupAlbumActionPerformed

    private void jMenuItemArtistAlbumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemArtistAlbumActionPerformed
        //ανοίγει την φόρμα άλμπουμ καλλιτεχνών
        ArtistAlbumGUI frame= new ArtistAlbumGUI(this);
        frame.setLocation((int) this.getLocation().getX(),(int) this.getLocation().getY());
        frame.setVisible(true);
        this.setEnabled(false); //απενεργοποιεί το παρόν μέχει να κλείσει το frame
    }//GEN-LAST:event_jMenuItemArtistAlbumActionPerformed

    private void jMenuPlaylistMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuPlaylistMouseClicked
        //ανοίγει την φόρμα διαχείρισης Playlist
        PlaylistSongGUI playListFrame= new PlaylistSongGUI(this);
        playListFrame.setLocation((int) this.getLocation().getX(),(int) this.getLocation().getY());
        playListFrame.setVisible(true);
        this.setEnabled(false); //απενεργοποιεί το παρόν μέχει να κλείσει το frame
    }//GEN-LAST:event_jMenuPlaylistMouseClicked

    private void jMenuExitMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuExitMouseClicked
        System.out.println("Αντίο!");
        System.exit(0); //εξοδος από το σύστημα 
    }//GEN-LAST:event_jMenuExitMouseClicked

    private void jButtonAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAboutActionPerformed
        About about=new About();
        about.setLocation(this.getX(), this.getY());
        about.setVisible(true);
    }//GEN-LAST:event_jButtonAboutActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainMenuGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainMenuGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainMenuGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainMenuGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(() -> {
            new MainMenuGUI().setVisible(true);
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonAbout;
    private javax.swing.JFrame jFrame1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuItem jMenuArtist;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenu jMenuExit;
    private javax.swing.JMenuItem jMenuItemArtistAlbum;
    private javax.swing.JMenuItem jMenuItemGroup;
    private javax.swing.JMenuItem jMenuItemGroupAlbum;
    private javax.swing.JMenu jMenuPlaylist;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration//GEN-END:variables
}
